package o;

import android.os.Handler;
import android.os.Looper;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import androidx.annotation.RestrictTo.d;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;

@RestrictTo({d.ˊ})
public class dg extends di {
    @Nullable
    private volatile Handler ˊ;
    private final ExecutorService ˋ = Executors.newFixedThreadPool(2, new ThreadFactory(this) {
        private final AtomicInteger ˏ = new AtomicInteger(0);
        final /* synthetic */ dg ॱ;

        {
            this.ॱ = r3;
        }

        public Thread newThread(Runnable runnable) {
            Thread thread = new Thread(runnable);
            thread.setName(String.format("arch_disk_io_%d", new Object[]{Integer.valueOf(this.ˏ.getAndIncrement())}));
            return thread;
        }
    });
    private final Object ˎ = new Object();

    public void ˎ(Runnable runnable) {
        this.ˋ.execute(runnable);
    }

    public void ˋ(Runnable runnable) {
        if (this.ˊ == null) {
            synchronized (this.ˎ) {
                if (this.ˊ == null) {
                    this.ˊ = new Handler(Looper.getMainLooper());
                }
            }
        }
        this.ˊ.post(runnable);
    }

    public boolean ˋ() {
        return Looper.getMainLooper().getThread() == Thread.currentThread();
    }
}
